package cn.portx.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bstek.bdf3.dorado.jpa.annotation.Generator;
import com.bstek.dorado.annotation.PropertyDef;

import cn.portx.policy.CreateUserPolicy;
import cn.portx.policy.CreatedDatePolicy;
import cn.portx.policy.IdGeneratorPolicy;

/**
 * Model class of 费目权限.
 * 
 * @author generated by ERMaster
 * @version $Id$
 */
@Entity
@Table(name = "T_EXPENSE_AUTHORITY", indexes = { @Index(name = "ExpenseAuthority_roleId", columnList = "ROLE_ID_") })
public class ExpenseAuthority extends BaseEntity {

	/** serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** 角色ID. */
	@Column(name = "ROLE_ID_", length = 60)
	private String roleId;

	/** 费目ID. */
	@Column(name = "EXPENSE_ITEM_ID_", length = 60)
	private String expenseItemId;

	@Transient
	private ExpenseItem expenseItem;

	/** 权限. */
	@Column(name = "AUTHORITY_", length = 60)
	@PropertyDef(label = "权限", description = "0：不可看；1：可看；2：可看可改")
	private String authority;

	/**
	 * Constructor.
	 */
	public ExpenseAuthority() {
	}

	/**
	 * Set the 角色ID.
	 * 
	 * @param roleId
	 *            角色ID
	 */
	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	/**
	 * Get the 角色ID.
	 * 
	 * @return 角色ID
	 */
	public String getRoleId() {
		return this.roleId;
	}

	/**
	 * Set the 权限.
	 * 
	 * @param authority
	 *            权限
	 */
	public void setAuthority(String authority) {
		this.authority = authority;
	}

	/**
	 * Get the 权限.
	 * 
	 * @return 权限
	 */
	public String getAuthority() {
		return this.authority;
	}

	public String getExpenseItemId() {
		return expenseItemId;
	}

	public void setExpenseItemId(String expenseItemId) {
		this.expenseItemId = expenseItemId;
	}

	public ExpenseItem getExpenseItem() {
		return expenseItem;
	}

	public void setExpenseItem(ExpenseItem expenseItem) {
		this.expenseItem = expenseItem;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		ExpenseAuthority other = (ExpenseAuthority) obj;
		if (this.getId() == null) {
			if (other.getId() != null) {
				return false;
			}
		} else if (!this.getId().equals(other.getId())) {
			return false;
		}
		return true;
	}

}
